package com.ehotting.mqbd.zw.client.config;

import com.ehotting.eaf.netty.loggers.NettyMsgReceiveLogger;
import com.ehotting.eaf.netty.loggers.NettyMsgSendLogger;
import com.ehotting.eaf.redis.service.RedisService;
import com.ehotting.mqbd.api.enums.DirectionEnum;
import com.ehotting.mqbd.api.enums.TopicEnum;
import com.ehotting.mqbd.api.bean.MqApplicationContext;
import com.ehotting.mqbd.core.config.MqbdCoreServerInfoConfig;
import com.ehotting.mqbd.core.helper.IPHelper;
import com.ehotting.mqbd.core.logger.MqMsgLogger;
import com.ehotting.mqbd.core.manager.AgentLinkManager;
import com.ehotting.mqbd.core.manager.ModuleManager;
import com.ehotting.mqbd.core.manager.SolverInfoManager;
import com.ehotting.mqbd.core.sync.MqSyncFutureMapHelper;
import com.ehotting.mqbd.zw.client.mq.MqTcpConsumerResponseAction;
import com.ehotting.mqbd.zw.client.mq.ZwMqActionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;

@Configuration
public class ZwClientConfig {


    /**
     * 配置因为处理类扫描
     * @return
     */
    @Bean("zwMqActionFactory")
    @DependsOn(value = "springUtils")
    public ZwMqActionFactory zwMqActionFactory(){
        ZwMqActionFactory actionFactory = new ZwMqActionFactory();
        actionFactory.setScanPackage("com.ehotting.mqbd.zw.client.mqAction");
        return actionFactory;
    }


    @Bean
    public MqTcpConsumerResponseAction mqTcpConsumerResponseAction(ZwMqActionFactory zwMqActionFactory,
                                                                   MqSyncFutureMapHelper mqSyncFutureMapHelper,
                                                                   MqApplicationContext mqApplicationContext,
                                                                   ModuleManager moduleManager,
                                                                   MqMsgLogger mqMsgLogger,AgentLinkManager agentLinkManager){
        MqTcpConsumerResponseAction handler = new MqTcpConsumerResponseAction(
                mqSyncFutureMapHelper,
                mqApplicationContext,
                TopicEnum.CONCURRENCY,
                DirectionEnum.RESPONSE,
                null,
                moduleManager,mqMsgLogger,agentLinkManager);
        handler.setZwMqActionFactory(zwMqActionFactory);
        return handler;
    }

}
